package com.wulis.seckill.business.controller;

import com.wulis.seckill.business.service.AccountService;
import com.wulis.seckill.common.wrapper.ResponseData;
import com.wulis.seckill.common.wrapper.ResponseDataUtil;
import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/login")
@Api(tags = "用户登录")
@AllArgsConstructor
public class LoginController {

    private final AccountService accountService;

    /**
     *  
     * @return
     */
    @PostMapping(value = "/test")
    public ResponseData login(String account,String password){

        return ResponseDataUtil.buildSuccess();
    }


    public static void main(String[] args) {
        BCryptPasswordEncoder bCryptPasswordEncoder = new BCryptPasswordEncoder();

        String encode1 = bCryptPasswordEncoder.encode("1234");
        System.out.println("encode1:" + encode1);
        System.out.println(bCryptPasswordEncoder.matches("1234",encode1));

        String encode2 = bCryptPasswordEncoder.encode("1234");
        System.out.println("encode2:" + encode2);
        System.out.println(bCryptPasswordEncoder.matches("1233",encode2));
    }

}
